



/**
 * 
 */
var pushBlogForm = function() {
    // Init Lock Form Validation, for more examples you can check out https://github.com/jzaefferer/jquery-validation
    var initValidata = function(){
        jQuery('#blog_content_form').validate({
            errorClass: 'help-block text-right animated fadeInDown',
            errorElement: 'div',
            errorPlacement: function(error, e) {
                jQuery(e).parents('.form-group > div').append(error);
            },
            highlight: function(e) {
                jQuery(e).closest('.form-group').removeClass('has-error').addClass('has-error');
                jQuery(e).closest('.help-block').remove();
            },
            success: function(e) {
                jQuery(e).closest('.form-group').removeClass('has-error');
                jQuery(e).closest('.help-block').remove();
            },
            rules: {
                'blog-title': {
                    required: true,
                    minlength: 5
                },
                'blog-desc': {
                    required: true,
                    minlength: 5
                },
                'blog-type': {
                    required: true
                }
            },
            messages: {
                'blog-title': {
                    required: '请输入主题标题...',
                    minlength: '主题标题长度至少5位'
                },
                'blog-desc': {
                    required: '请输入主题描述',
                    minlength: '主题描述长度至少5位'
                },
                'blog-type': "请选择主题类型"
            }
        });
    };

    return {
        init: function () {
            // Init Reminder Form Validation
        	initValidata();
        }
    };
}();

// Initialize when page loads
jQuery(function(){ pushBlogForm.init(); });